package com.espirit.eap.manager.workflow;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;

import com.espirit.EntityMapping;
import com.googlecode.cswish.model.Saas;

@Entity
public class WFCondition extends EntityMapping implements Serializable, Saas{
	/**
	 * 
	 */
	private static final long serialVersionUID = -5472870313178321524L;
	
	public static final Integer ACCEPT_TRIGGER_ALWAYS = 0;
	public static final Integer ACCEPT_TRIGGER_CONDITION = 1;
	
	private Integer acceptTrigger;
	private String triggerCondition;
	
	private Integer sid;
	public Integer getSid() {
		return sid;
	}

	public void setSid(Integer sid) {
		this.sid = sid;
	}
	
	public Integer getAcceptTrigger() {
		return acceptTrigger;
	}
	public void setAcceptTrigger(Integer acceptTrigger) {
		this.acceptTrigger = acceptTrigger;
	}
	
	@Column(length = 1000)
	public String getTriggerCondition() {
		return triggerCondition;
	}
	public void setTriggerCondition(String triggerCondition) {
		this.triggerCondition = triggerCondition;
	}
	
	public void verify(){
		/*
		if (triggerCondition != null){
			boolean pass = FreemarkerTplEngine.getInstance().verify(triggerCondition ,null); 
			if (!pass){
				throw new ApplicationException("errors.workflow.condition.expressionError" );
			}
		}
		*/
	}
}
